#pragma once
#include <iostream>
#include <vector>
#include <hash_map>
#include "Type.h"
using namespace stdext;
using namespace std;


class Parent {
	private:
		hash_map<Type::Index::Line,vector<Type::Index::Line>> parentRelation;
		hash_map<Type::Index::Line,Type::Index::Line> revertParentRelation;
		bool isPresent(vector<int>,int);
		vector<vector<bool>> parentBitMap;
		bool parentBitMapSetFlag;

	public:
		Parent(void);
		~Parent(void);

		///Set the first Type::Index::Line as the parent of the second Type::Index::Line
		void setParent(Type::Index::Line, Type::Index::Line);
		
		/*!
		return a set of Type::Index::Line which are the direct child of the given Type::Index::Line
		if none is found, return an empty vector
		*/
		vector<Type::Index::Line> getChild(Type::Index::Line);

		/*!
		return the direct parent of the given Type::Index::Line
		if none is found, return -1
		*/
		Type::Index::Line getParent(Type::Index::Line);

		
		///return true if given Type::Index::Line has parent		
		bool hasParent(Type::Index::Line);
		
		///return true if given Type::Index::Line has child
		bool hasChild(Type::Index::Line);
		
		///return true if the first Type::Index::Line is the direct Parent of the second Type::Index::Line
		bool isParent(Type::Index::Line, Type::Index::Line);

		//return true if the bitMap is set correctly
		bool setParentBitMap(vector<vector<bool>>);

		bool isBitMapSet();

};